<div class="crumb-wrap">
    <div class="crumb-list"><i class="icon-font"></i><a href="<?=site_url()?>">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">推广项目</span></div>
</div>
<div class="result-wrap">
        <div class="result-content">
            <table class="result-tab" width="100%">
                <tr>
                    <th>ID</th>
                    <th>排序</th>
                    <th>项目名称</th>
                    <th>项目状态</th>
                    <th>单价（￥）</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                <?php foreach($list as $k => $v):?>
                <tr>
                    <td><?=$v['id']?></td>
                    <td>
                        <input class="common-input sort-input" value="<?=$v['sort']?>" type="text" readonly="readonly" onclick="set_sort(<?=$v['id']?>,<?=$v['sort']?>)">
                    </td>
                    <td><?=$v['p_name']?></td>
                    <td><?=$v['status'] == 1 ? '上线' : '<span style="color:red">未上线<span>';?></td>
                    <td><?=$v['price']?></td>
                    <td><?=date('Y-m-d H:i:s',$v['create_time'])?></td>
                    <td>
                        <a class="link-update" href="<?=site_url('project/update?pid='.$v['id'])?>">修改</a>
                    </td>
                </tr>
                <?php endforeach;?>
            </table>
        </div>
</div>
<script type="text/javascript">
    
    layer.config({
        extend: 'extend/layer.ext.js'
    });  

    function set_sort(pid,val){
        layer.prompt({
            title: '输入数字（值越大越靠前）',
            formType: 0, //prompt风格，支持0-2
            value : val || 1
        }, function(pass){
            $.post("<?=site_url('project/set_sort')?>",{pid:pid,val:pass},function(res){
                if(res == 1){
                    location.reload(true);
                }else{
                    layer.alert(res,{
                        icon:2,
                    });
                }
            });
        });
    }
</script>